package com.rd.student.jike.class1.fangzhou.Exam;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;

public class Test01 {
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        String name;
        int china,math,all;
        BufferedWriter writer = new BufferedWriter(new FileWriter("Student.txt"));
        writer.write("姓名 语文成绩 数学成绩 总分");
        writer.newLine();
        int n;
        System.out.println("请选择录入学生的数量：");
        n = sc.nextInt();
        for(int i=1;i<n+1;i++){
            System.out.println("请输入第"+i+"名学生的姓名：");
            name = sc.next();
            System.out.println("请输入语文成绩：");
            china = sc.nextInt();
            System.out.println("请输入数学成绩：");
            math = sc.nextInt();
            all = china + math;
            String st = name+" "+china+" "+math+" "+all;
            writer.write(st);
            writer.newLine();
        }
        writer.close();
    }
}
